package cn.ahaiahaixx.dp.prototype;

/**
 * 原型
 * 
 * @author Aiden Pearce
 *
 */
public class MyPrototype {
  private int pid;
  private String info;

  public MyPrototype() {

  }

  public int getPid() {
    return pid;
  }

  public void setPid(int pid) {
    this.pid = pid;
  }

  public String getInfo() {
    return info;
  }

  public void setInfo(String info) {
    this.info = info;
  }

  @Override
  public String toString() {
    return "MyPrototype [pid=" + pid + ", info=" + info + "]";
  }

  public MyPrototype(int pid, String info) {
    this.pid = pid;
    this.info = info;
  }
  
  /**
   * 创建一个自己的副本，这个就是原型模式
   * @return
   */
  public MyPrototype copyMe() {
    MyPrototype prototype=new MyPrototype();
    prototype.setPid(pid);
    prototype.setInfo(info);
    return prototype;
  }

}
